package com.wiscamp.ninechapters.problems.infrastructure.converters;

import com.wiscamp.ninechapters.problems.domain.models.types.ProblemType;
import com.wiscamp.ninechapters.problems.infrastructure.po.types.ProblemTypePO;
import com.wiscamp.ninechapters.problems.infrastructure.po.types.ProblemTypeView;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface ProblemTypeConverter {
    ProblemTypeConverter Instance = Mappers.getMapper(ProblemTypeConverter.class);

    ProblemTypePO toProblemTypePO(ProblemType entity);

    ProblemTypePO toProblemTypePO(ProblemType entity, @MappingTarget ProblemTypePO po);

    ProblemType toProblemType(ProblemTypePO po);

    ProblemType toProblemTypeByView(ProblemTypeView view);
}
